package com.cyj.springbootservice.controller.oss;

import com.baomidou.mybatisplus.extension.api.R;
import com.cyj.springbootservice.utils.AliOssUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @description:
 * @Author C_Y_J
 * @create 2021/11/17 11:04
 **/
@RestController
@RequestMapping("/ali/oss")
public class AliOssController {
    /**
     * 文件上传
     *
     * @param file 文件对象
     * @return
     */
    @PostMapping("/_upload")
    public R upload(@RequestParam("file") MultipartFile file) throws Exception {
        return R.ok(AliOssUtil.uploadFile(file));
    }
}
